package com.csy.basethread;

import com.csy.util.ILogFactory;
import org.junit.Test;

public class Test004 implements ILogFactory {
    @Test
    public void main() {
        Thread thread1 = new Thread(() -> {
            for (int i = 0; i < 30; i++) {
                //log.info("子线程1-i:{}", i)
                System.out.println("子线程1-i:"+ i);
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        //设置为守护线程和主线程一起结束
        //thread1.setDaemon(true);
        thread1.start();
        for (int i = 0; i < 5; i++) {
            log.info("主线程 i:{}", i);
        }
        log.info("主线程结束。。。。。。");
    }
}
